package com.zhuiwei.springbootcache.mapper;

import com.zhuiwei.springbootcache.bean.Employee;
import org.apache.ibatis.annotations.*;

/**
 * @author zhuwei
 * @version 2019/05/22
 */
@Mapper
public interface EmployeeMapper {

    @Select("select * from employee where id=#{id}")
    public Employee getEmpById(Integer id);

    @Delete("delete from employee where id=#{id}")
    public int deleteEmpById(Integer id);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into employee(lastName,email,gender,d_Id) values(#{lastName},#{email},#{gender},#{dId},)")
    public int insertEmployee(Employee employee);

    @Update("update department set lastName=#{lastName},email=#{email},gender=#{gender},d_Id=#{dId} where id=#{id}")
    public int updateEmployee(Employee employee);

    @Select("SELECT * FROM employee WHERE lastName=#{lastName}")
    Employee getEmpByLastName(String lastName);

}
